//
//  NSString+Util.m
//  XiRan-iOS
//
//  Created by liuyiming on 2019/11/28.
//  Copyright © 2019 Wood. All rights reserved.
//

#import "NSString+Util.h"

@implementation NSString (Util)

//字典转JSON
+ (NSString *)convertJSONWithDic:(NSDictionary *)dic {
    NSError *err;
    NSData *data = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&err];
    if (err) {
        return @"字典转JSON出错";
    }
    return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
}

@end
